
<?php
$id = rand(0,1000);

?>
<div id="main-{{$id}}" style="width: 100%;height:400px;"></div>
<script src="https://cdn.staticfile.org/echarts/4.3.0/echarts.min.js"></script>
<script type="text/javascript">
    var _hmt = _hmt || [];
    (function() {
        var hm = document.createElement("script");
        hm.src = "https://cdn.staticfile.org/echarts/4.3.0/echarts.min.js";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
        hm.onload=function(){


            // 基于准备好的dom，初始化echarts实例
            var myChart = echarts.init(document.getElementById('main-{{$id}}'));

            // 指定图表的配置项和数据
            var option = {
                title: {
                    text: '上量数据'
                },
                tooltip: {
                    trigger: 'axis'
                },
                grid: {
                    left: '3%',
                    right: '4%',
                    bottom: '3%',
                    containLabel: true
                },
                toolbox: {
                    feature: {
                        saveAsImage: {}
                    }
                },
                xAxis: [
                    {
                        type: 'category',
                        data: [@foreach($read_info as $item) '{{ $item->time }}', @endforeach],
                        boundaryGap: false
                    },
                    ],
                yAxis: {
                    type: 'value'
                },
                series: [
                    {
                        name: '阅读增量',
                        type: 'line',
                        data: [@foreach($read_info as $item) '{{ $item->read_num_inc }}',@endforeach],
                        smooth: true,
                        itemStyle: {
                            normal: {
                                label: {
                                    show: true
                                }
                            }
                        }
                    },

                ]
            };

            // 使用刚指定的配置项和数据显示图表。
            myChart.setOption(option);
        }
    })();


</script>
